mark-to-json
Parse the markdown into a JSON static file, also support multiple-level directories.
Installing
npm i mark-to-json --save
yarn add mark-to-json
Usage
API | Required | default | Description |
---|
token | true | | Your markdown file content including yaml matter |
dest | false | ./default.json | Your JSON static file will be created at the place based on the current nodejs working path |
extraHeader | false | {} | It will be mix in JSON file if you want to add some extra data to JSON static file |
contentKey | false | content | It will be the key of markdown content part in JSON static file |
Sample
const Mtj = require('mark-to-json')
new Mtj({
token: '---\ntitle: Hello world\n---\nThis is content.',
dest: './writings/hello-world.json',
extraHeader: {
errno: 0
},
contentKey: 'content'
})
The sample output file: here
Changelog
Changelog